#ifndef PAGECONTROLLER_H
#define PAGECONTROLLER_H

#include <QStackedWidget>
#include <QWidget>
#include <QLayout>
#include <QStack>
#include <QUuid>
#include <QHash>
#include "mypushbutton.h"

class PageController : public QObject {
    Q_OBJECT
public:
    explicit PageController(QStackedWidget* stackedWidget,
                            QObject* parent = nullptr);
public:
    QString addPage(MyPushButton *btn, QWidget *page);

    void removePage(const QString& pageId);

    void switchToPage(const QString& pageId);

    QString currentPageId() const;

private:
    QString createId() const;

private:
    QStackedWidget* _stackedWidget = nullptr;
    QHash<QString, QPair<MyPushButton*, QWidget*>> _pageId;
    QString _currentPageId;
};

#endif // PAGECONTROLLER_H
